import { LoginInfo } from "f2e-server3";
import React from "react";

interface Props {
    info: LoginInfo
}
const UserInfo = (props: Props) => {
    const { info } = props
    const infos = [
        ["nickname", info?.user?.nickname],
        ["username", info?.user?.username],
        ["token", info?.token],
        ["expire", info?.expire && new Date(info.expire).toLocaleString()],
        ["login_ip", info?.ip],
        ["last_url", info?.last_url],
        ["user_agent", info?.ua],
    ]

    return (<>
        <section className="bg-white">
            <div className="container">
                <div className="grid">
                    {infos.map(([label, info]) => <div key={label}>
                        <h2 className="font-medium text-gray-800">{label}</h2>
                        <p className="mt-2 text-gray-500">{info}</p>
                    </div>)}
                </div>
            </div>
        </section>
    </>)
}
export default UserInfo